

set(Boost_USE_STATIC_LIBS ON)

if(MSVC)
    set(Boost_USE_STATIC_RUNTIME ON)
endif()

find_package(Boost 1.72 REQUIRED
    COMPONENTS thread filesystem iostreams program_options
    HINTS ${CMAKE_SOURCE_DIR}/prepare/boost/install)


macro(includePreparedLib name)
    include_directories(${CMAKE_SOURCE_DIR}/prepare/${name}/install/include)
    link_directories(APPEND CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/prepare/${name}/install/lib)
endmacro()

includePreparedLib(zlib)
includePreparedLib(libpng)
includePreparedLib(openssl)
includePreparedLib(libssh2)
includePreparedLib(libgit2)

message(STATUS "use boost include dir: ${Boost_INCLUDE_DIRS}")
message(STATUS "use boost libraries: ${Boost_LIBRARIES}")

add_definitions(
    -DBOOST_BEAST_USE_STD_STRING_VIEW
)

if(MSVC)
    add_compile_options(/D "_WIN32_WINNT=0x0A00")
    add_compile_options(/MT)
    add_compile_options(/wd4819)
endif()

#enable_testing()
#find_package(GTest REQUIRED)

include_directories(
    "${PROJECT_SOURCE_DIR}/src"
    "${PROJECT_SOURCE_DIR}/third/libgit2_wrapper/libgit2-1.3.0/include"
    "${PROJECT_SOURCE_DIR}/third/lpng_wrapper/lpng1636"
    "${CMAKE_BINARY_DIR}/third/lpng_wrapper/lpng1636"
    "${PROJECT_SOURCE_DIR}/third/zlib_wrapper/zlib-1.2.11"
    "${CMAKE_BINARY_DIR}/third/zlib_wrapper/zlib-1.2.11"
    "${Boost_INCLUDE_DIRS}"
)

add_subdirectory(util)
add_subdirectory(git-util)
add_subdirectory(book)
add_subdirectory(abc-server)
#add_subdirectory(test)
